package com.example.chengzhengwei;


import java.util.List;

public class CsvUtils {
    public static String generateCsvData(List<RunData> dataList) {
        StringBuilder sb = new StringBuilder();

        // 添加表头
        sb.append("ID,Channel,Value,Timestamp,Minutes,Seconds\n");

        // 添加数据行
        for (RunData data : dataList) {
            sb.append(data.getId()).append(",")
                    .append(data.getChannel()).append(",")
                    .append(data.getValue()).append(",")
                    .append(data.getTimestamp()).append(",")
                    .append(data.getMinutes()).append(",")
                    .append(data.getSeconds()).append("\n");
        }

        return sb.toString();
    }
}